package rickyGame.game
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	import ricky.game.Actor;
	import ricky.game.graphic.Graphic;
	
	import rickyGame.model.config.*;
	import rickyGame.game.graphic.PlayerGraphic;
	import rickyGame.game.property.Ai;
	import rickyGame.game.property.Equipment;
	import rickyGame.game.property.FightPro;
	import rickyGame.game.property.Skill;
	import rickyGame.server.SpellController;

	/**
	 * 玩家类
	 */
	public class Player extends Fighter
	{
		public function Player()
		{
			_ai=new Ai(this);
			_fightPro=new FightPro(this);
			_skills=new Skill(this);
			_equipment=new Equipment();
			graphic=new PlayerGraphic(this);
			_stateNames=new Array();

		}
		
		/**
		 * 装备
		 */
		public function get equipment():Equipment
		{
			return _equipment;
		}
		
		public function set equipment(value:Equipment):void
		{
			_equipment=value;
		}
		
		override public function load(uint:Object):void
		{
			super.load(uint);
			this.name=uint.name;
			this.speed=uint.speed;
			this.asType=uint.type;
			this.ai.init(uint.perception);
		}
		
		override public function set speed(value:Number):void
		{
			super.speed=value;
			PlayerGraphic(graphic).fps=speed/10;
		}
		
		/**
		 * 根据等级加载数据
		 */
		override public function loadProperty(level:int):void
		{
			fightPro.level=level;//等级
			fightPro.load(level);//战斗属性
			var sps:Array=data.ability.split(",");//技能
			
			for each(var skillName:String in sps)
				skills.learn(skillName);
			
			skills.learnAttack(data.attack1);
		}

//		/**
//		 * 感知函数
//		 */
//		override public function perception(type:String, target:Actor=null):void
//		{
//			
//		}
		
		//private 
        private var _equipment:Equipment;// 装备代码(目前只有前2者) [0],衣服[1],武器 [2],头盔 [3],腰带 [4],护手[5],鞋子 [6],项链 [7],戒指1 [8],戒指2

	}
}